TCP (Transmission Control Protocol) is the most common transmission layer protocol used in the current network world, which provides reliable data transmission between two points on the Internet. At present, the most popular protocols, such as Telnet, FTP (File Transfer Protocol), HTTP (Hyper Text Transfer Protocol) and so on, are all based on TCP technology. TCP is a connection-oriented protocol. TCP connection should be established before data are transmitted between two network nodes, and the data transmission is performed according to the current TCP connection state.
As the important applications running on the network become more and more, various key network nodes generally employ a high-availability system that works in active/standby switching mode to reduce the down time. In FIG. 1, node B is a distributed device that includes an active board and a standby board, and a TCP connection is established between node B and node A. During normal operations, the logical TCP connection between node A and node B is actually accomplished by the active board of node A and node B. When a problem occurs on the active board, the standby board takes over the active board.
For a TCP connection, before the original TCP connection is continued, the standby board must know the connection state during active/standby switching, such as the sequence number that has been used by the sending party and the receiving party; otherwise, the standby board has to reestablish a new TCP connection with node A. However, the reestablishment of a TCP connection may cause serious problems in some cases; for example, node A and node B are two routers, and the TCP connection is used for bearing BGP (Border Gateway Protocol), once a TCP connection is reestablished, Route Oscillation may be caused for a period of time. Therefore, the state synchronization of TCP connection becomes the key of the problem.
In the prior art, two methods are usually employed to synchronize TCP connection state. Taking node A and node B in FIG. 1 as an example again, the first synchronization method is as shown in FIG. 2, each time a TCP message is transmitted between node A and the active board of node B, the active board notifies the standby board of the TCP connection state information contained in each message via a TCP synchronization message between the active board and the standby board, thus the standby board may continue the original TCP connection via the backup connection state information. The second synchronization method is as shown in FIG. 3, the active board of node B duplicates the TCP message received from node A and transmits it to the standby board, and similarly, the active board of node B duplicates the message that is sent to node A and transmits it to the standby board, and the standby board keeps the TCP connection state synchronized with that of the active board according to the duplicated message received from the active board.
These two methods may solve the problem of TCP connection state synchronization to a certain degree, but may not be effective in all cases. Because the active board may generate synchronization information or duplicate the message and send it to the standby board only after a TCP message from node A is received; and even if the active board sends the duplicated message or synchronization information to the standby board while it sends the TCP message to node A, considering that the active board needs to process heavy service load at the same time, it is difficult to guarantee that the two sending processes are implemented simultaneously according to the process scheduling mechanism of the operating system; in other words, it is basically inevitable that a certain time difference will exist between the message transmission of node A and node B and the state synchronization of the active/standby board. Moreover, in the case that the active board fails, the time when active/standby switching occurs is uncontrollable, and the standby board may take over the active board at any moment. Therefore, whether the standby board is capable of successfully continuing the original TCP connection depends on whether the state synchronization condition is consistent with the message transmission condition when switching occurs. Once the two conditions are inconsistent, the original TCP connection state is unable to be recovered, and a TCP connection has to be reestablished between node A and node B.
Further, these two methods both require that real-time synchronization of TCP connection may be realized between the active board and the standby board, thus a large amount of information are transmitted between the active board and the standby board, which causes a large amount of bandwidth between the active board and the standby board and CPU (Central Process Unit) resources may be consumed, so that the device performance may be degraded.